<?php
class CreateImages extends CakeMigration {

/**
 * Migration description
 *
 * @var string
 * @access public
 */
	public $description = '';

/**
 * Actions to be performed
 *
 * @var array $migration
 * @access public
 */
	public $migration = array(
		'up' => array(
			'create_table' => array(
				'images' => array(
					  'id' => array('type'    =>'integer',
										      'null'    => false,
													'key'			=> 'primary'),
						'photo'	=> array('type' => 'string', 'null' => false),
						'dir' => array('type' => 'string', 'default' => null),
						'mimetype' => array('type' => 'string', 'default' => null),
						'filesize' => array('type' => 'integer', 'default' => null),
						'order' => array('type' => 'integer', 'default' => 0),
						'url' => array('type' => 'string'),
						'owner_id' => array('type' => 'integer'),
						'owner_model' => array('type' => 'string'),
					  'indexes' => array(
					      'PRIMARY' => array(
					          'column' => 'id',
					          'unique' => 1)
					  )
				)
			)
		),
		'down' => array(
			'drop_table' => array(
				'images'
			),
		),
	);

/**
 * Before migration callback
 *
 * @param string $direction, up or down direction of migration process
 * @return boolean Should process continue
 * @access public
 */
	public function before($direction) {
		return true;
	}

/**
 * After migration callback
 *
 * @param string $direction, up or down direction of migration process
 * @return boolean Should process continue
 * @access public
 */
	public function after($direction) {
		return true;
	}
}
